package com.sthz.facepay.mapper;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import com.sthz.facepay.model.Classification;

public class ClassificationSqlProvider {

    public String insertSelective(Classification record) {
        BEGIN();
        INSERT_INTO("st_classification");
        
        if (record.getId() != null) {
            VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getName() != null) {
            VALUES("name", "#{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPeid() != null) {
            VALUES("peid", "#{peid,jdbcType=INTEGER}");
        }
        
        if (record.getCoid() != null) {
            VALUES("coid", "#{coid,jdbcType=INTEGER}");
        }
        
        if (record.getOpid() != null) {
            VALUES("opid", "#{opid,jdbcType=INTEGER}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(Classification record) {
        BEGIN();
        UPDATE("st_classification");
        
        if (record.getName() != null) {
            SET("name = #{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPeid() != null) {
            SET("peid = #{peid,jdbcType=INTEGER}");
        }
        
        if (record.getCoid() != null) {
            SET("coid = #{coid,jdbcType=INTEGER}");
        }
        
        if (record.getOpid() != null) {
            SET("opid = #{opid,jdbcType=INTEGER}");
        }
        
        WHERE("id = #{id,jdbcType=INTEGER}");
        
        return SQL();
    }
}